Image statistics for motion detection

ABSTRACT

Embodiments of the present disclosure relate to generating motion vectors. An image signal processor includes a statistics circuit and a vector correlation analysis circuit. The statistics circuit determines image statistics such as vectors representing sums of pixel values of rows or columns of blocks of an image. Additionally, the statistics circuit may mix or aggregate sums of multiple color components. The vector correlation analysis performs cross-correlation between vectors of a current image and reference vectors of a prior image to determine cross-correlation scores. The vector correlation analysis generates a motion vector by identifying shifts in horizontal and vertical directions corresponding to peak values of cross-correlation scores.

BACKGROUND 1. Field of the Disclosure

The present disclosure relates a circuit and methods for processingimages and more specifically for autofocusing images using motionestimation.

2. Description of the Related Arts

Image data captured by an image sensor or received from other datasources is often processed in an image processing pipeline beforefurther processing or consumption. For example, raw image data may becorrected, filtered, or otherwise modified before being provided tosubsequent components such as a video encoder. To perform corrections orenhancements for captured image data, various components, unit stages ormodules may be employed.

Such an image processing pipeline may be structured so that correctionsor enhancements to the captured image data can be performed in anexpedient way without consuming other system resources. Although manyimage processing algorithms may be performed by executing softwareprograms on central processing unit (CPU), execution of such programs onthe CPU would consume significant bandwidth of the CPU and otherperipheral resources as well as increase power consumption. Hence, imageprocessing pipelines are often implemented as a hardware componentseparate from the CPU and dedicated to perform one or more imageprocessing algorithms.

SUMMARY

Embodiments relate to motion estimation and autofocusing of images. Animage signal processor may determine statistics of pixels of an image togenerate a motion vector. Pixel values of a current image may becompared with pixel values of a prior image to determine shift betweenthe images. The motion vector may indicate information associated with aproperty of an image such as an amount of rotation or shift in ahorizontal direction and a vertical direction.

In one embodiment, the motion vector can be used to assist autofocusingof an image. The motion vector may be determined by accumulating pixelvalues of a motion detection window of an image. The image may alsoinclude one or more autofocus windows. If it is determined that a givenone of the autofocus windows follows the motion detection window by atleast a threshold vertical distance, at least one property of theautofocus window may be adjusted according to at least the currentmotion vector. In some embodiments, adjusting the at least one propertyof the autofocus window includes shifting a horizontal or verticallocation of the autofocus window to compensate for detected motion inthe motion detection window.

In some embodiments, a vertical directional shift and horizontaldirectional shift is identified using cross-correlation scores of pixelvalues of the current and prior images, which are processed by a vectorcorrelation analysis circuit. A statistics circuit may include summationcircuits for adding pixel values in rows or columns of the currentimage.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a high-level diagram of an electronic device, according to oneembodiment

FIG. 2 is a block diagram illustrating components in the electronicdevice, according to one embodiment.

FIG. 3 is a block diagram illustrating image processing pipelinesimplemented using an image signal processor, according to oneembodiment.

FIG. 4 is a block diagram illustrating a motion estimator, according toone embodiment.

FIG. 5 is a block diagram illustrating a pipeline of the statisticscircuit, according to one embodiment.

FIG. 6 is a diagram of row sums of blocks of an image, according to oneembodiment.

FIG. 7 is a diagram of column sums of blocks of an image, according toone embodiment.

FIG. 8 is a diagram of aggregated sums of blocks of an image, accordingto one embodiment.

FIG. 9 is a diagram of autofocus windows, according to one embodiment.

FIG. 10 is a flowchart illustrating a method of generating a motionvector, according to one embodiment.

FIG. 11 is a flowchart illustrating a method of performing autofocusing,according to one embodiment.

The figures depict, and the detail description describes, variousnon-limiting embodiments for purposes of illustration only.

DETAILED DESCRIPTION

Reference will now be made in detail to embodiments, examples of whichare illustrated in the accompanying drawings. In the following detaileddescription, numerous specific details are set forth in order to providea thorough understanding of the various described embodiments. However,the described embodiments may be practiced without these specificdetails. In other instances, well-known methods, procedures, components,circuits, and networks have not been described in detail so as not tounnecessarily obscure aspects of the embodiments.

Embodiments of the present disclosure relate to autofocusing of imagesusing motion vectors generated by an image signal processor of a device.An image being processed may include one or more motion detectionwindows associated with a motion vector as well as one or more autofocuswindows. An autofocus window that follows a motion detection window byat least a threshold vertical distance may be selected, e.g., to accountfor a period of time (or latency) for determining a motion vector of themotion detection window. The device may perform autofocusing by shiftinglocation of the selected autofocus window.

Exemplary Electronic Device

Embodiments of electronic devices, user interfaces for such devices, andassociated processes for using such devices are described. In someembodiments, the device is a portable communications device, such as amobile telephone, that also contains other functions, such as personaldigital assistant (PDA) and/or music player functions. Exemplaryembodiments of portable multifunction devices include, withoutlimitation, the iPhone®, iPod Touch®, Apple Watch®, and iPad® devicesfrom Apple Inc. of Cupertino, Calif. Other portable electronic devices,such as wearables, laptops or tablet computers, are optionally used. Insome embodiments, the device is not a portable communications device,but is a desktop computer or other computing device that is not designedfor portable use. In some embodiments, the disclosed electronic devicemay include a touch sensitive surface (e.g., a touch screen displayand/or a touch pad). An example electronic device described below inconjunction with FIG. 1 (e.g., device 100) may include a touch-sensitivesurface for receiving user input. The electronic device may also includeone or more other physical user-interface devices, such as a physicalkeyboard, a mouse and/or a joystick.

Figure (FIG. 1 is a high-level diagram of an electronic device 100,according to one embodiment. Device 100 may include one or more physicalbuttons, such as a “home” or menu button 104. Menu button 104 is, forexample, used to navigate to any application in a set of applicationsthat are executed on device 100. In some embodiments, menu button 104includes a fingerprint sensor that identifies a fingerprint on menubutton 104. The fingerprint sensor may be used to determine whether afinger on menu button 104 has a fingerprint that matches a fingerprintstored for unlocking device 100. Alternatively, in some embodiments,menu button 104 is implemented as a soft key in a graphical userinterface (GUI) displayed on a touch screen.

In some embodiments, device 100 includes touch screen 150, menu button104, push button 106 for powering the device on/off and locking thedevice, volume adjustment buttons 108, Subscriber Identity Module (SIM)card slot 110, head set jack 112, and docking/charging external port124. Push button 106 may be used to turn the power on/off on the deviceby depressing the button and holding the button in the depressed statefor a predefined time interval; to lock the device by depressing thebutton and releasing the button before the predefined time interval haselapsed; and/or to unlock the device or initiate an unlock process. Inan alternative embodiment, device 100 also accepts verbal input foractivation or deactivation of some functions through microphone 113. Thedevice 100 includes various components including, but not limited to, amemory (which may include one or more computer readable storagemediums), a memory controller, one or more central processing units(CPUs), a peripherals interface, an RF circuitry, an audio circuitry,speaker 111, microphone 113, input/output (I/O) subsystem, and otherinput or control devices. Device 100 may include one or more imagesensors 164, one or more proximity sensors 166, and one or moreaccelerometers 168. The device 100 may include components not shown inFIG. 1.

Device 100 is only one example of an electronic device, and device 100may have more or fewer components than listed above, some of which maybe combined into a components or have a different configuration orarrangement. The various components of device 100 listed above areembodied in hardware, software, firmware or a combination thereof,including one or more signal processing and/or application specificintegrated circuits (ASICs).

FIG. 2 is a block diagram illustrating components in device 100,according to one embodiment. Device 100 may perform various operationsincluding image processing. For this and other purposes, the device 100may include, among other components, image sensor 202, system-on-a chip(SOC) component 204, system memory 230, persistent storage (e.g., flashmemory) 228, orientation sensor 234, and display 216. The components asillustrated in FIG. 2 are merely illustrative. For example, device 100may include other components (such as speaker or microphone) that arenot illustrated in FIG. 2. Further, some components (such as orientationsensor 234) may be omitted from device 100.

Image sensor 202 is a component for capturing image data and may beembodied, for example, as a complementary metal-oxide-semiconductor(CMOS) active-pixel sensor) a camera, video camera, or other devices.Image sensor 202 generates raw image data that is sent to SOC component204 for further processing. In some embodiments, the image dataprocessed by SOC component 204 is displayed on display 216, stored insystem memory 230, persistent storage 228 or sent to a remote computingdevice via network connection. The raw image data generated by imagesensor 202 may be in a Bayer color filter array (CFA) pattern(hereinafter also referred to as “Bayer pattern”).

Motion sensor 234 is a component or a set of components for sensingmotion of device 100. Motion sensor 234 may generate sensor signalsindicative of orientation and/or acceleration of device 100. The sensorsignals are sent to SOC component 204 for various operations such asturning on device 100 or rotating images displayed on display 216.

Display 216 is a component for displaying images as generated by SOCcomponent 204. Display 216 may include, for example, liquid crystaldisplay (LCD) device or an organic light emitting diode (OLED) device.Based on data received from SOC component 204, display 116 may displayvarious images, such as menus, selected operating parameters, imagescaptured by image sensor 202 and processed by SOC component 204, and/orother information received from a user interface of device 100 (notshown).

System memory 230 is a component for storing instructions for executionby SOC component 204 and for storing data processed by SOC component204. System memory 230 may be embodied as any type of memory including,for example, dynamic random access memory (DRAM), synchronous DRAM(SDRAM), double data rate (DDR, DDR2, DDR3, etc.) RAMBUS DRAM (RDRAM),static RAM (SRAM) or a combination thereof. In some embodiments, systemmemory 230 may store pixel data or other image data or statistics invarious formats.

Persistent storage 228 is a component for storing data in a non-volatilemanner. Persistent storage 228 retains data even when power is notavailable. Persistent storage 228 may be embodied as read-only memory(ROM), flash memory or other non-volatile random access memory devices.

SOC component 204 is embodied as one or more integrated circuit (IC)chip and performs various data processing processes. SOC component 204may include, among other subcomponents, image signal processor (ISP)206, a central processor unit (CPU) 208, a network interface 210, sensorinterface 212, display controller 214, graphics processor (GPU) 220,memory controller 222, video encoder 224, storage controller 226, andvarious other input/output (I/O) interfaces 218, and bus 232 connectingthese subcomponents. SOC component 204 may include more or fewersubcomponents than those shown in FIG. 2.

ISP 206 is hardware that performs various stages of an image processingpipeline. In some embodiments, ISP 206 may receive raw image data fromimage sensor 202, and process the raw image data into a form that isusable by other subcomponents of SOC component 204 or components ofdevice 100. ISP 206 may perform various image-manipulation operationssuch as image translation operations, horizontal and vertical scaling,color space conversion and/or image stabilization transformations, asdescribed below in detail with reference to FIG. 3.

CPU 208 may be embodied using any suitable instruction set architecture,and may be configured to execute instructions defined in thatinstruction set architecture. CPU 208 may be general-purpose or embeddedprocessors using any of a variety of instruction set architectures(ISAs), such as the x86, PowerPC, SPARC, RISC, ARM or MIPS ISAs, or anyother suitable ISA. Although a single CPU is illustrated in FIG. 2, SOCcomponent 204 may include multiple CPUs. In multiprocessor systems, eachof the CPUs may commonly, but not necessarily, implement the same ISA.

Graphics processing unit (GPU) 220 is graphics processing circuitry forperforming graphical data. For example, GPU 220 may render objects to bedisplayed into a frame buffer (e.g., one that includes pixel data for anentire frame). GPU 220 may include one or more graphics processors thatmay execute graphics software to perform a part or all of the graphicsoperation, or hardware acceleration of certain graphics operations.

I/O interfaces 218 are hardware, software, firmware or combinationsthereof for interfacing with various input/output components in device100. I/O components may include devices such as keypads, buttons, audiodevices, and sensors such as a global positioning system. I/O interfaces218 process data for sending data to such I/O components or process datareceived from such I/O components.

Network interface 210 is a subcomponent that enables data to beexchanged between devices 100 and other devices via one or more networks(e.g., carrier or agent devices). For example, video or other image datamay be received from other devices via network interface 210 and bestored in system memory 230 for subsequent processing (e.g., via aback-end interface to image signal processor 206, such as discussedbelow in FIG. 3) and display. The networks may include, but are notlimited to, Local Area Networks (LANs) (e.g., an Ethernet or corporatenetwork) and Wide Area Networks (WANs). The image data received vianetwork interface 210 may undergo image processing processes by ISP 206.

Sensor interface 212 is circuitry for interfacing with motion sensor234. Sensor interface 212 receives sensor information from motion sensor234 and processes the sensor information to determine the orientation ormovement of the device 100.

Display controller 214 is circuitry for sending image data to bedisplayed on display 216. Display controller 214 receives the image datafrom ISP 206, CPU 208, graphic processor or system memory 230 andprocesses the image data into a format suitable for display on display216.

Memory controller 222 is circuitry for communicating with system memory230. Memory controller 222 may read data from system memory 230 forprocessing by ISP 206, CPU 208, GPU 220 or other subcomponents of SOCcomponent 204. Memory controller 222 may also write data to systemmemory 230 received from various subcomponents of SOC component 204.

Video encoder 224 is hardware, software, firmware or a combinationthereof for encoding video data into a format suitable for storing inpersistent storage 128 or for passing the data to network interface w10for transmission over a network to another device.

In some embodiments, one or more subcomponents of SOC component 204 orsome functionality of these subcomponents may be performed by softwarecomponents executed on ISP 206, CPU 208 or GPU 220. Such softwarecomponents may be stored in system memory 230, persistent storage 228 oranother device communicating with device 100 via network interface 210.

Image data or video data may flow through various data paths within SOCcomponent 204. In one example, raw image data may be generated from theimage sensor 202 and processed by ISP 206, and then sent to systemmemory 230 via bus 232 and memory controller 222. After the image datais stored in system memory 230, it may be accessed by video encoder 224for encoding or by display 116 for displaying via bus 232.

In another example, image data is received from sources other than theimage sensor 202. For example, video data may be streamed, downloaded,or otherwise communicated to the SOC component 204 via wired or wirelessnetwork. The image data may be received via network interface 210 andwritten to system memory 230 via memory controller 222. The image datamay then be obtained by ISP 206 from system memory 230 and processedthrough one or more image processing pipeline stages, as described belowin detail with reference to FIG. 3. The image data may then be returnedto system memory 230 or be sent to video encoder 224, display controller214 (for display on display 216), or storage controller 226 for storageat persistent storage 228.

Example Image Signal Processing Pipelines

FIG. 3 is a block diagram illustrating image processing pipelinesimplemented using ISP 206, according to one embodiment. In theembodiment of FIG. 3, ISP 206 is coupled to image sensor 202 to receiveraw image data. ISP 206 implements an image processing pipeline whichmay include a set of stages that process image information fromcreation, capture or receipt to output. ISP 206 may include, among othercomponents, sensor interface 302, central control module 320, front-endpipeline stages 330, back-end pipeline stages 340, image statisticsmodule 304, vision module 322, back-end interface 342, and outputinterface 316. ISP 206 may include other components not illustrated inFIG. 3 or may omit one or more components illustrated in FIG. 3.

Sensor interface 302 receives raw image data from image sensor 202 andprocesses the raw image data into an image data processable by otherstages in the pipeline. Sensor interface 302 may perform variouspreprocessing operations, such as image cropping, binning or scaling toreduce image data size. In some embodiments, pixels are sent from theimage sensor 202 to sensor interface 302 in raster order (i.e.,horizontally, line by line). The subsequent processes in the pipelinemay also be performed in raster order and the result may also be outputin raster order. Although only a single image sensor and a single sensorinterface 302 are illustrated in FIG. 3, when more than one image sensoris provided in device 100, a corresponding number of sensor interfacesmay be provided in ISP 206 to process raw image data from each imagesensor.

Front-end pipeline stages 330 process image data in raw or full-colordomains. Front-end pipeline stages 330 may include, but are not limitedto, raw processing stage 306 and resample processing stage 308. A rawimage data may be in Bayer raw format, for example. In Bayer raw imageformat, pixel data with values specific to a particular color (insteadof all colors) is provided in each pixel. In an image capturing sensor,image data is typically provided in a Bayer pattern. Raw processingstage 306 may process image data in a Bayer raw format.

The operations performed by raw processing stage 306 include, but arenot limited, sensor linearization, black level compensation, fixedpattern noise reduction, defective pixel correction, raw noisefiltering, lens shading correction, white balance gain, and highlightrecovery. Sensor linearization refers to mapping non-linear image datato linear space for other processing. Black level compensation refers toproviding digital gain, offset and clip independently for each colorcomponent (e.g., Gr, R, B, Gb) of the image data. Fixed pattern noisereduction refers to removing offset fixed pattern noise and gain fixedpattern noise by subtracting a dark frame from an input image andmultiplying different gains to pixels. Defective pixel correction refersto detecting defective pixels, and then replacing defective pixelvalues. Raw noise filtering refers to reducing noise of image data byaveraging neighbor pixels that are similar in brightness. Highlightrecovery refers to estimating pixel values for those pixels that areclipped (or nearly clipped) from other channels. Lens shading correctionrefers to applying a gain per pixel to compensate for a dropoff inintensity roughly proportional to a distance from a lens optical center.White balance gain refers to providing digital gains for white balance,offset and clip independently for all color components (e.g., Gr, R, B,Gb in Bayer format). Components of ISP 206 may convert raw image datainto image data in full-color domain, and thus, raw processing stage 306may process image data in the full-color domain in addition to orinstead of raw image data.

Resample processing stage 308 performs various operations to convert,resample, or scale image data received from raw processing stage 306.Operations performed by resample processing stage 308 may include, butnot limited to, demosaic operation, per-pixel color correctionoperation, Gamma mapping operation, color space conversion anddownscaling or sub-band splitting. Demosaic operation refers toconverting or interpolating missing color samples from raw image data(for example, in a Bayer pattern) to output image data into a full-colordomain. Demosaic operation may include low pass directional filtering onthe interpolated samples to obtain full-color pixels. Per-pixel colorcorrection operation refers to a process of performing color correctionon a per-pixel basis using information about relative noise standarddeviations of each color channel to correct color without amplifyingnoise in the image data. Gamma mapping refers to converting image datafrom input image data values to output data values to perform gammacorrection. For the purpose of Gamma mapping, lookup tables (or otherstructures that index pixel values to another value) for different colorcomponents or channels of each pixel (e.g., a separate lookup table forR, G, and B color components) may be used. Color space conversion refersto converting color space of an input image data into a differentformat. In one embodiment, resample processing stage 308 converts RGBformat into YCbCr format for further processing.

Central control module 320 may control and coordinate overall operationof other components in ISP 206. Central control module 320 performsoperations including, but not limited to, monitoring various operatingparameters (e.g., logging clock cycles, memory latency, quality ofservice, and state information), updating or managing control parametersfor other components of ISP 206, and interfacing with sensor interface302 to control the starting and stopping of other components of ISP 206.For example, central control module 320 may update programmableparameters for other components in ISP 206 while the other componentsare in an idle state. After updating the programmable parameters,central control module 320 may place these components of ISP 206 into arun state to perform one or more operations or tasks. Central controlmodule 320 may also instruct other components of ISP 206 to store imagedata (e.g., by writing to system memory 230 in FIG. 2) before, during,or after resample processing stage 308. In this way full-resolutionimage data in raw or full-color domain format may be stored in additionto or instead of processing the image data output from resampleprocessing stage 308 through backend pipeline stages 340.

Image statistics module 304 performs various operations to collectstatistic information associated with the image data. The operations forcollecting statistics information may include, but not limited to,sensor linearization, replace patterned defective pixels, sub-sample rawimage data, detect and replace non-patterned defective pixels, blacklevel compensation, lens shading correction, and inverse black levelcompensation. After performing one or more of such operations,statistics information such as 3A statistics (Auto white balance (AWB),auto exposure (AE), autofocus (AF)), histograms (e.g., 2D color orcomponent) and any other image data information may be collected ortracked. In some embodiments, certain pixels' values, or areas of pixelvalues may be excluded from collections of certain statistics data(e.g., AF statistics) when preceding operations identify clipped pixels.The image statistics module 304 includes a motion estimator 305, whichmay generate image statistics for autofocusing of images (e.g.,performed in software and/or hardware). The motion estimator 305 isfurther described below with reference to FIG. 4. Although only a singlestatistics module 304 is illustrated in FIG. 3, multiple imagestatistics modules may be included in ISP 206. In such embodiments, eachstatistic module may be programmed by central control module 320 tocollect different information for the same or different image data.

Vision module 322 performs various operations to facilitate computervision operations at CPU 208 such as facial detection in image data. Thevision module 322 may perform various operations includingpre-processing, global tone-mapping and Gamma correction, vision noisefiltering, resizing, keypoint detection, generation ofhistogram-of-orientation gradients (HOG) and normalized crosscorrelation (NCC). The pre-processing may include subsampling or binningoperation and computation of luminance if the input image data is not inYCrCb format. Global mapping and Gamma correction can be performed onthe pre-processed data on luminance image. Vision noise filtering isperformed to remove pixel defects and reduce noise present in the imagedata, and thereby, improve the quality and performance of subsequentcomputer vision algorithms. Such vision noise filtering may includedetecting and fixing dots or defective pixels, and performing bilateralfiltering to reduce noise by averaging neighbor pixels of similarbrightness. Various vision algorithms use images of different sizes andscales. Resizing of an image is performed, for example, by binning orlinear interpolation operation. Keypoints are locations within an imagethat are surrounded by image patches well suited to matching in otherimages of the same scene or object. Such keypoints are useful in imagealignment, computing camera pose and object tracking. Keypoint detectionrefers to the process of identifying such keypoints in an image. HOGprovides descriptions of image patches for tasks in mage analysis andcomputer vision. HOG can be generated, for example, by (i) computinghorizontal and vertical gradients using a simple difference filter, (ii)computing gradient orientations and magnitudes from the horizontal andvertical gradients, and (iii) binning the gradient orientations. NCC isthe process of computing spatial cross correlation between a patch ofimage and a kernel.

Back-end interface 342 receives image data from other image sources thanimage sensor 202 and forwards it to other components of ISP 206 forprocessing. For example, image data may be received over a networkconnection and be stored in system memory 230. Back-end interface 342retrieves the image data stored in system memory 230 and provides it toback-end pipeline stages 340 for processing. One of many operations thatare performed by back-end interface 342 is converting the retrievedimage data to a format that can be utilized by back-end processingstages 340. For instance, back-end interface 342 may convert RGB, YCbCr4:2:0, or YCbCr 4:2:2 formatted image data into YCbCr 4:4:4 colorformat.

Back-end pipeline stages 340 processes image data according to aparticular full-color format (e.g., YCbCr 4:4:4 or RGB). In someembodiments, components of the back-end pipeline stages 340 may convertimage data to a particular full-color format before further processing.Back-end pipeline stages 340 may include, among other stages, noiseprocessing stage 310 and color processing stage 312. Back-end pipelinestages 340 may include other stages not illustrated in FIG. 3.

Noise processing stage 310 performs various operations to reduce noisein the image data. The operations performed by noise processing stage310 include, but are not limited to, color space conversion,gamma/de-gamma mapping, temporal filtering, noise filtering, lumasharpening, and chroma noise reduction. The color space conversion mayconvert an image data from one color space format to another color spaceformat (e.g., RGB format converted to YCbCr format). Gamma/de-gammaoperation converts image data from input image data values to outputdata values to perform gamma correction or reverse gamma correction.Temporal filtering filters noise using a previously filtered image frameto reduce noise. For example, pixel values of a prior image frame arecombined with pixel values of a current image frame. Noise filtering mayinclude, for example, spatial noise filtering. Luma sharpening maysharpen luma values of pixel data while chroma suppression may attenuatechroma to gray (i.e. no color). In some embodiment, the luma sharpeningand chroma suppression may be performed simultaneously with spatial nosefiltering. The aggressiveness of noise filtering may be determineddifferently for different regions of an image. Spatial noise filteringmay be included as part of a temporal loop implementing temporalfiltering. For example, a previous image frame may be processed by atemporal filter and a spatial noise filter before being stored as areference frame for a next image frame to be processed. In otherembodiments, spatial noise filtering may not be included as part of thetemporal loop for temporal filtering (e.g., the spatial noise filter maybe applied to an image frame after it is stored as a reference imageframe and thus the reference frame is not spatially filtered).

Color processing stage 312 may perform various operations associatedwith adjusting color information in the image data. The operationsperformed in color processing stage 312 include, but are not limited to,local tone mapping, gain/offset/clip, color correction,three-dimensional color lookup, gamma conversion, and color spaceconversion. Local tone mapping refers to spatially varying local tonecurves in order to provide more control when rendering an image. Forinstance, a two-dimensional grid of tone curves (which may be programmedby the central control module 320) may be bi-linearly interpolated suchthat smoothly varying tone curves are created across an image. In someembodiments, local tone mapping may also apply spatially varying andintensity varying color correction matrices, which may, for example, beused to make skies bluer while turning down blue in the shadows in animage. Digital gain/offset/clip may be provided for each color channelor component of image data. Color correction may apply a colorcorrection transform matrix to image data. 3D color lookup may utilize athree dimensional array of color component output values (e.g., R, G, B)to perform advanced tone mapping, color space conversions, and othercolor transforms. Gamma conversion may be performed, for example, bymapping input image data values to output data values in order toperform gamma correction, tone mapping, or histogram matching. Colorspace conversion may be implemented to convert image data from one colorspace to another (e.g., RGB to YCbCr). Other processing techniques mayalso be performed as part of color processing stage 312 to perform otherspecial image effects, including black and white conversion, sepia toneconversion, negative conversion, or solarize conversion.

Output rescale module 314 may resample, transform and correct distortionon the fly as the ISP 206 processes image data. Output rescale module314 may compute a fractional input coordinate for each pixel and usesthis fractional coordinate to interpolate an output pixel via apolyphase resampling filter. A fractional input coordinate may beproduced from a variety of possible transforms of an output coordinate,such as resizing or cropping an image (e.g., via a simple horizontal andvertical scaling transform), rotating and shearing an image (e.g., vianon-separable matrix transforms), perspective warping (e.g., via anadditional depth transform) and per-pixel perspective divides applied inpiecewise in strips to account for changes in image sensor during imagedata capture (e.g., due to a rolling shutter), and geometric distortioncorrection (e.g., via computing a radial distance from the opticalcenter in order to index an interpolated radial gain table, and applyinga radial perturbance to a coordinate to account for a radial lensdistortion).

Output rescale module 314 may apply transforms to image data as it isprocessed at output rescale module 314. Output rescale module 314 mayinclude horizontal and vertical scaling components. The vertical portionof the design may implement series of image data line buffers to holdthe “support” needed by the vertical filter. As ISP 206 may be astreaming device, it may be that only the lines of image data in afinite-length sliding window of lines are available for the filter touse. Once a line has been discarded to make room for a new incomingline, the line may be unavailable. Output rescale module 314 maystatistically monitor computed input Y coordinates over previous linesand use it to compute an optimal set of lines to hold in the verticalsupport window. For each subsequent line, output rescale module mayautomatically generate a guess as to the center of the vertical supportwindow. In some embodiments, output rescale module 314 may implement atable of piecewise perspective transforms encoded as digital differenceanalyzer (DDA) steppers to perform a per-pixel perspectivetransformation between a input image data and output image data in orderto correct artifacts and motion caused by sensor motion during thecapture of the image frame. Output rescale may provide image data viaoutput interface 316 to various other components of device 100, asdiscussed above with regard to FIGS. 1 and 2.

In various embodiments, the functionally of components 302 through 342may be performed in a different order than the order implied by theorder of these functional units in the image processing pipelineillustrated in FIG. 3, or may be performed by different functionalcomponents than those illustrated in FIG. 3. Moreover, the variouscomponents as described in FIG. 3 may be embodied in variouscombinations of hardware, firmware or software.

Example Motion Estimator

FIG. 4 is a block diagram illustrating a motion estimator 305, accordingto one embodiment. The motion estimator 305 processes images todetermine statistics such as shift between images in a horizontal orvertical direction. Additionally, the motion estimator 305 may use thestatistics to generate motion vectors, for example, to be used forautofocusing. The motion estimator 305 may include, among othercomponents, statistics circuit 402 and vector correlation analysis (VCA)circuit 408.

In the embodiment of FIG. 4, statistics circuit 402 receives input imagedata 404 captured by the image sensor 202. The input image data 404 maybe provided by the sensor interface 302 or received from a source memory(e.g., system memory 230, persistent storage 228, or a cache) of thedevice 100. The input image data 404 may have one or multiple colorcomponents or channels. In some embodiments, the image sensor 202captures images using a Bayer filter including color filters for red,green, and blue. The input image data 404 may include color componentsfor a red, red subtype of green (“Gr”), blue, and blue subtype of green(“Gb”). The color components may be arranged in any suitable order(e.g., GRBG, RGGB, BGGR, GBRG, etc.). In addition, the statisticscircuit 402 can divide (e.g., a window of) the input image data 404 intoblocks of pixels in the vertical and horizontal directions, e.g., wherethe blocks are adjacent to each other and/or do not overlap each other.In some embodiments, dimensions of the blocks may be even integernumbers, and the dimensions of the blocks may be at least four pixels.

The statistics circuit 402 generates image statistics such as row sumsand column sums of pixel values (e.g., intensity values) of the inputimage data 404. A row sum represents a sum of pixel values across a rowof pixels in one or more blocks of an image. A column sum represents asum of pixel values across a column of pixels in one or more blocks ofan image. In some embodiments, the output of the statistics circuit 402can be used to detect fixed pattern noise in images. The statisticscircuit 402 may determine the sums by accumulating pixel values across arow or column of pixel values for each block of the input image data404. The pixel values may be accumulated for specific color components,and the statistics circuit 402 can apply weighted sums of multiple colorcomponents.

The statistics circuit 402 provides generated image statistics 406 tothe VCA circuit 408 to perform further image processing. The imagestatistics 406 provided to the VCA circuit 408 may include statisticsthat are weighted summation of multiple color components. The statisticscircuit 402 can store image statistics 410 or other relevant informationto the system memory 230 via direct memory access. The image statistics410 stored to system memory 230 may be for a particular color component,for example, so that image statistics for red, green, and blue arestored separately instead of being summed to a single component. Sincedirect memory access operates independently from the CPU 208, the motionestimator 305 may offload resource intensive operations or otheroverhead associated with the motion estimation or autofocusingoperations from the CPU 208. The statistics circuit 402 is furtherdescribed below with respect to FIG. 5.

The VCA circuit 408 generates a motion vector using the image statistics406 received from the statistics circuit 402. The motion vectorindicates estimated motion of a current image relative to a prior imageupon which the prior image statistics is based. As an example, thecurrent and prior images each capture an image of an entity such as aperson or an object. There may be shifting of the entity (and/or of thedevice 100) or movements of objects in images during a period of timebetween capturing of the current and prior images. The device 100 canuse the motion vector to compensate for the estimated motion, which mayimprove quality or other attributes of the current image. In someembodiments, the VCA circuit 408 can enable detection for one of thehorizontal or vertical directions and disable correction for the otherdirection, or enable detection for both directions.

The VCA circuit 408 generates motion vectors using cross-correlationscores. The VCA circuit 408 determines cross-correlation scores bycross-correlating sums of pixel values of a current image and those of aprior image. The sums of pixel values of the current image may bereferred to herein as vectors, and the sums of pixel values of the priorimage may be referred to herein as reference vectors. Sums of rows ofpixel values represent a vertical directional vector, andcross-correlation scores between vertical directional vectors of currentimage and a prior image represents a vertical directional shift.Likewise, sums of columns of pixel values represent a horizontaldirectional vector, and cross-correlation scores between horizontaldirectional vectors of current image and a prior image represents ahorizontal directional shift. In some embodiments, the VCA circuit 408may implement normalized cross-correlation (NCC).

The VCA circuit 408 may retrieve vectors of current images from theimage statistics 406. Further, the VCA circuit 408 may retrievereference vectors 412 from system memory 230 via direct memory access(DMA) or from a register. The reference vectors 412 may be previouslygenerated by the statistics circuit 402 and may be modified in front endprocessing. For instance, the VCA circuit 408 performs one or more of(in any particular order): compressing data size of vectors, croppingvectors (e.g., shorten vectors to a target length), performing spatialbinning, determining a weighted sum of multiple color components,applying offset and scaling factors to vector values, or performinggamma correction or non-linear transformation. In some embodiments, theVCA circuit 408 uses a look up table (LUT) for transforming values of areference vector to reduce the impact of noise, boost responsivity ofdark areas, or equalize a signal-to-noise ratio. In addition, the VCAcircuit 408 may perform normalization to compensate for changes inlighting, e.g., exposure or white balance. The VCA circuit 408 may usespatial binning to reduce vector size and thus reduce processing time. Avector of a current image may also be modified in front end processingusing one or more of the above mentioned techniques.

The VCA circuit 408 may provide the motion vector 414 to othercomponents of the ISP 206 or SOC component 204 for further processing.For example, the CPU 208 may use the motion vector 414 to performautofocusing operations, which is further described below with referenceto FIG. 9.

Example Statistics Circuit

FIG. 5 is a block diagram illustrating a pipeline of the statisticscircuit 402, according to one embodiment. The statistics circuit 402 mayinclude, among other components, row summation circuit 502, row sumbuffer 504, column summation circuit 508, column sum buffer 510, firstmultiplexer 516, mixer 520, and second multiplexer 526.

The row summation circuit 502 and the column summation circuit 508receive image data 404 input to the statistics circuit 402. The rowsummation circuit 502 determines row sums of an image, for example, byadding pixel values in the same row position across columns of blocks ofan image, as described below with reference to FIG. 6. The row sumbuffer 504 receives and stores values 506 of row sums or intermediaterow sums. In particular, the row sum buffer 504 buffers the values asthe row summation circuit 502 iterates across rows of the blocks toaccumulate pixel values.

The column summation circuit 508 determines column sums of the image,for example, by adding pixel values in the same column position acrossrows of blocks of the image, as described below with reference to FIG.7. The column sum buffer 510 receives and stores values 512 of columnsums or intermediate column sums. In particular, the column sum buffer510 buffers the values as the column summation circuit 508 iteratesacross columns of the blocks to accumulate pixel values. In variousembodiments, the column summation circuit 508 and row summation circuit502 determine sums of pixel values separately for different colorcomponents.

The first multiplexer 516 has an input coupled to the row sum buffer 504and another input coupled to the column sum buffer 510 to receiveaccumulated sums 514 of pixel values from the buffers. Particularly, thefirst multiplexer 516 receives row sums and column sums from the row sumbuffer 504 and the column sum buffer 510, respectively. The firstmultiplexer 516 selectively forwards the row sums and the column sums tothe mixer 520 or the second multiplexer 526.

The mixer 520 is coupled to the row summation circuit 502 and the columnsummation circuit 508, e.g., through the first multiplexer 516.Accumulated sums received by the mixer 520 from the summation circuitsmay be associated with one given color component. The mixer 520determines a weighted sum of (or “mixes”) row sums of pixel values andcolumn sums of pixel values of multiple color components. The mixer 520can output the sums as image statistics 406 and can also provide thesums to the second multiplexer 526. The second multiplexer 526 selectsbetween outputs of the first multiplexer 516 and the mixer 520 forstorage using DMA. For instance, the second multiplexer 526 stores imagestatistics 410 for separate color components or a weighted sum of colorcomponents to system memory 230 or to registers.

In some embodiments, the first multiplexer 516 or the second multiplexer526 may select outputs as indicated by parameter values retrieved fromone or more registers. A parameter value may indicate that output to theVCA circuit 408 is enabled (e.g., an enable bit or flag). Additionally,a parameter value may indicate information for operation of thestatistics circuit 402 or the VCA circuit 408, for instance, a number ofwindows to be processed for an image, a number of blocks, a number ofcolumns or rows, size of vectors, or color component configuration of animage (e.g., weights of R, Gr, B, and Gb for the mixer 520).

Example Sums of Pixel Values of Blocks

FIGS. 6 through 8 illustrate accumulation of sums of pixel values of awindow (e.g., a motion detection window) of an image 902. In theexamples illustrated in FIGS. 6 through 8, a window of a current imageis divided into a row of four blocks that are identical in dimension.Windows may be a subset of pixels of an image and may berectangular-shaped. Since the blocks have identical dimensions, theblocks have a same number of rows and columns of pixels. In otherembodiments, the motion estimator 305 may divide windows into any numberof blocks arranged in any number of rows or columns.

In a sub-window mode, the statistics circuit 402 accumulates column sumsand row sums for each block. Additionally, the VCA circuit 408determines cross-correlation scores for each column sum and row sum of ablock of the window with those from a prior image. In some embodiments,the VCA circuit 408 generates a motion vector for the window of thecurrent image by determining a greatest one of the cross-correlationscores. For example, the greatest correlation score corresponds to thebest estimation of vertical shift or horizontal shift detected by themotion estimator 305 across the blocks in the window. A window used forgenerating motion vectors may be referred to herein as a motiondetection window. The VCA circuit 408 may generate other motion vectorshaving different values for other windows of a same image. For instance,a motion vector of a first window capturing an image of a moving objectwill result in greater amounts of shift than another motion vector of asecond window capturing an image of a stationary object. The VCA circuit408 may write motion vectors or associated values to one or moreregisters.

FIG. 6 is a diagram of row sums of blocks of an image, according to oneembodiment. In the illustrated example, the statistics circuit 402determines row sums 604A, 604B, 604C, and 604D for block 602A, 602B,602C, and 602D, respectively. The VCA circuit 408 performscross-correlation in a vertical correlation direction using vectors ofthe row sums 604A-D and reference vectors of a prior image. Inparticular, the VCA circuit 408 correlates each of the vectors with areference vector determined by adding pixel values of a correspondingsegment in the prior image. For example, vector 604A represents a sum ofpixel values in the n^(th) column position (iterated over rows of thecurrent image) of the first block of the illustrated window of thecurrent image. Additionally, vector 606 represents a sum of pixel valuesin the n^(th) column position (iterated over rows of the prior image) ofthe first block of the same window of the prior image.

Since the size of the vector 604A may be greater than the size ofreference vector 606, the VCA circuit 408 may determine whether anypixel values of the vector 604A shifted in the vertical correlationdirection relative to pixel values of the reference vector 606. Asoutput of the correlation of vector 604A and reference vector 606, theVCA circuit 408 determines cross-correlation score 608, whichcorresponds to the correlation score at each vertical directional shiftof pixels in the window between the current and prior image at then^(th) column of the first block, with the greatest score valuerepresenting the best estimated vertical directional shift at the n^(th)column between the current and prior image.

FIG. 7 is a diagram of column sums of blocks of an image, according toone embodiment. In the illustrated example, the statistics circuit 402determines column sums 704A, 704B, 704C, and 704D for block 702A, 702B,702C, and 702D, respectively. The VCA circuit 408 performscross-correlation in a horizontal correlation direction using vectors ofthe column sums 704A-D and reference vectors of a prior image.Cross-correlation of column sums is substantially the same ascross-correlation of row sums, except for the different correlationdirection. For instance, the VCA circuit 408 correlates each of thevectors with a reference vector determined by adding pixel values of acorresponding segment (e.g., column) in the prior image. Moreover, theVCA circuit 408 may determine whether any pixel values of the vector704A shifted in the horizontal correlation direction relative to pixelvalues of the reference vector 706 because the size of the vector 704Amay be greater than the size of reference vector 706.

In various embodiments, the VCA circuit 408 uses peak finding todetermine a greatest one of the cross-correlation scores in each of thecorrelation directions, e.g., horizontal and vertical. If it isdetermined that a window has multiple maximum cross-correlation scores,the VCA circuit 408 may select the first instance of a greatest score,e.g., corresponding to a vector closest to an origin of a coordinatesystem of the window. The VCA circuit 408 may also optionally performsub-pixel location interpolation to obtain sub-pixel precision of thegreatest scores. In sub-window mode, the VCA circuit 408 may determineaverage values or median values of multiple motion vectors of the blocksfor a horizontal and vertical component of an overall motion vector of awindow. In some embodiments, the average values may be rounded to thenearest integer.

The VCA circuit 408 may use less computational resources to calculatemotion vectors using the embodiments described herein, in comparison toconventional motion detection methods. Convention methods can requirecomparison of a greater number of pixels between a current image andreference image by scanning across all pixels of the images, which canbe time-consuming and introduce more latency. By dividing images intoblocks for determining image statistics, the motion estimator 305 canreduce a number of required pixel value calculations or comparisons.Based on the locations and sizes of the windows, VCA circuit 408 maycomplete the motion vectors computation of windows ahead of the last rowof the image frame.

FIG. 8 is a diagram of aggregated sums of blocks of an image, accordingto one embodiment. In aggregation mode, the statistics circuit 402accumulates column sums and row sums for each block of a window.Further, the statistics circuit 402 aggregates the row sums of theblocks for the window. In the example shown in FIG. 8, the statisticscircuit 402 aggregates row sums 804A, 804B, 804C, and 804D to generatevector 806 representing an aggregated row sum of a window. Thestatistics circuit 402 also aggregates the column sums of the blocks forthe window. For instance, the statistics circuit 402 aggregates columnsums 808A, 808B, 808C, and 808D to generate vector 810 representing anaggregated column sum of a window.

For a given window, the VCA circuit 408 determines a firstcross-correlation score 808 in the vertical correlation direction and asecond cross-correlation score 814 in the horizontal correlationdirection. The VCA circuit 408 determines the cross-correlation score808 by cross-correlating vector 806 and reference vector 816, which isdetermined using an aggregate row sum in the prior image. The VCAcircuit 408 determines the cross-correlation score 814 bycross-correlating vector 810 and reference vector 812, which isdetermined using an aggregate column sum in the prior image. The VCAcircuit 408 generates a motion vector for the window of the currentimage using the pair of cross-correlation scores 814 and 808.Particularly, the cross-correlation score 814 represents amount ofhorizontal shift and the cross-correlation score 808 represents amountof vertical shift detected by the motion estimator 305 across the blocksin the window.

The VCA circuit 408 may determine whether to use sub-window mode oraggregation mode case-by-case based on characteristics of a given image.For example, sub-window mode is used to estimate local motion at thesub-window (or window) locations, while aggregation mode is used toestimate global motion. Relative to a motion vector in sub-window mode,a motion vector in aggregation mode covers a larger field (e.g., numberof rows or columns of pixels), and thus may include additional imagefeatures. In embodiments where one or more images show a moving object,the VCA circuit 408 may determine to use sub-window mode to targetmotion estimation on the moving object. In other embodiments, the VCAcircuit 408 may determine to use aggregation mode to estimate globalmotion of the camera that captured processed images.

Example Autofocusing

FIG. 9 is a diagram of autofocus windows, according to one embodiment.In the illustrated example, the statistics circuit 402 generates imagestatistics of motion detection window 904 of image 902. Additionally,the VCA circuit 408 uses the image statistics to generate a motionvector of the motion detection window 904, e.g., using the processesdescribed above with respect to FIGS. 6 through 8.

In various embodiments, the motion estimator 305 processes pixels in a(e.g., raster) left-to-right and top-to-bottom manner, e.g., whenaccumulating sums of pixel values of rows or columns. An amount of timeis required for the motion estimator 305 to execute steps fordetermining motion vectors of windows in images. The threshold verticallocation (or coordinate) 910 shown in FIG. 9 indicates the amount oftime required to determine the motion vector of the motion detectionwindow 904. The amount of time includes 906, which is the time todetermine the motion vectors based on window 904, of the statisticscircuit 402 and/or the VCA circuit 408. The amount of time may be basedon coordinate position or size of the motion detection window 904. Forinstance, due to the top-to-bottom processing order, windows toward thebottom of the image 902 will require a greater amount of time, relativeto windows toward the top of the image 902. The motion estimator 305 mayaccount for a threshold vertical shift 908 as part of the thresholdvertical location 910. In some embodiments, the threshold vertical shift908 indicates a greatest allowable shift of an autofocus window in thevertical direction. If a vertical location of an auto focus window is onor after the threshold vertical location 910, it is considered that themotion detection window 904 is followed by the auto focus window afterat least a threshold vertical distance. The threshold vertical distancemay be used to determine whether to perform autofocusing, which isfurther described below with respect to FIG. 11.

The following description refers to the CPU 208 of a device 100performing autofocus of the example image 902. Though, in otherembodiments, another processor or computing device may perform theautofocusing by implementing any combination of software, hardware, orfirmware. The CPU 208 may perform autofocusing on one or more autofocuswindows such as autofocus windows 0, 1, 2, and 3 shown in FIG. 9. Inparticular, the CPU 208 determines whether a given autofocus window issuitable of being shifted for autofocusing by determining whether themotion detection window 904 is followed by a given autofocus window byat least the threshold vertical distance. As illustrated in FIG. 9,vertical locations of autofocus windows 0, 1, and 2 are within thethreshold vertical location 910. Therefore, it may be determined thatthe autofocus windows 0, 1, and 2 follow the motion detection window 904within the threshold vertical distance.

The CPU 208 can perform autofocusing on autofocus window 3 if it isdetermined that the motion detection window 904 is followed by autofocuswindow 3 by at least the threshold vertical location 910. The CPU 208may perform autofocusing by shifting autofocus window 3 to a modifiedposition, as indicted by autofocus window 3′. The CPU 208 determines ahorizontal and vertical distance to shift the autofocus window 3 basedon the motion vector of the motion detection window 904. For example,the CPU 208 retrieves motion vector values from a register, where themotion vector values indicate amounts to shift based oncross-correlation scores in the horizontal and vertical directions. Asillustrated in FIG. 9, the autofocus window 3′ may overlap a portion ofthe threshold vertical location 910. In some embodiments, since thethreshold vertical location 910 accounts for a threshold vertical shift908, the CPU 208 may shift an autofocus window upwards in the verticaldirection by an amount no greater than the threshold vertical shift 908.

Example Process Flows

FIG. 10 is a flowchart illustrating a method of generating a motionvector, according to one embodiment. Some embodiments may includedifferent and/or additional steps, or perform the steps in differentorders.

In one embodiment, the statistics circuit 402 determines 1002 row sumsof pixel values of each block of pixels in (e.g., an motion detectionwindow of) a current image. The statistics circuit 402 determines 1004column sums of the pixel values of each block of pixels in the currentimage. In some embodiments, the statistics circuit 402 may perform thesteps 1002-1004 in parallel for multiple color components or blocks ofan input image. In some embodiments, the statistics circuit 402determines row sums and column sums in an aggregation mode, for example,where pixel values are accumulated over adjacent pixels or blocks.

The VCA circuit 408 determines 1006 first cross-correlation scoresbetween the row sums of the pixel values of each block of pixels in thecurrent image with row sums of pixel values of each block of pixels in aprior image preceding the current image. The VCA circuit 408 determines1008 second cross-correlation scores between the column sums of thepixel values of each block of pixels in the current image with columnsums of the pixel values of each block of pixels in the prior image.Vectors of the current image may be greater in size than vectors of theprior image. For example, the row (or column) sums of the current image,or of the prior image, or both, may be cropped.

The VCA circuit 408 generates 1010 a motion vector for each block ofpixels in the current image, e.g., by identifying a vertical shiftcorresponding to a greatest one of the first cross-correlation scoresand a horizontal shift corresponding to a greatest one of the secondcross-correlation scores. The motion vector may be stored in a register(e.g., for later retrieval for performing autofocusing) or output toanother component such as a processor or memory of a correspondingdevice 100.

FIG. 11 is a flowchart illustrating a method of performing autofocusing,according to one embodiment. Some embodiments may include differentand/or additional steps, or perform the steps in different orders.

In one embodiment, a device 100 determines 1102 a current motion vectorof a motion detection window in a current image. The current motionvector of the motion detection window may be determined by the motionestimator 305 using the process shown in FIG. 10. The motion detectionwindow may have dimensions that are multiples of two, and may have adimension of at least eight pixels in width and height. In someembodiments, current motion vectors may be determined for multiplemotion detection windows (e.g., up to eight by eight) in a given image.

The CPU 208 of the device 100 determines 1104 a horizontal location anda vertical location of an autofocus window in the current image. Forinstance, as shown in of FIG. 9, the 2D image 902 includes multipleautofocus windows each having a different horizontal and verticallocation, e.g., coordinates in the X and Y axis. The CPU 208 determines1106 whether the motion detection window is followed by the autofocuswindow after at least a threshold vertical distance, where the thresholdvertical distance accounts for at least a period of time for determiningthe current motion vector. In some embodiments, the CPU 208 selects theautofocus window from a set of multiple autofocus windows. Referring tothe example shown in FIG. 9, the CPU 208 may select autofocus window 3from the other autofocus windows 0, 1, and 2, if it is determined thatautofocus window 3 is outside of the threshold vertical location 910. Inother embodiments, the CPU 208 may process up to sixteen or moreautofocus windows for a given image.

If it is determined that the motion detection window is followed by theautofocus window after at least the threshold vertical distance, the CPU208 performs autofocusing 1108 by adjusting at least one property of theautofocus window using the current motion vector. The property of theautofocus window may include a location, shape, size, or orientation ofthe autofocus window. For example, the CPU 208 may shift the horizontalof location of the autofocus window by a horizontal element of thecurrent motion vector. Additionally, the CPU 208 may shift the verticallocation of the autofocus window by a vertical element of the currentmotion vector. The CPU 208 may shift the location of the autofocuswindow along a vertical axis by an amount less than or equal to athreshold vertical shift, and along a horizontal axis by an amount lessthan or equal to a threshold horizontal shift. The threshold verticalshift and threshold horizontal shift may each be a multiple of two. Insome embodiments, the shifted location of the autofocus window overlapswithin the threshold vertical location 910 (as shown in the example ofFIG. 9). In other embodiments, adjusting the at least one propertyincludes one or more of: rotating the autofocus window by a certaindegree, modifying a shape of the autofocus window (e.g., from a squareto a different type of quadrilateral or polygon), or increasing ordecreasing a size of the autofocus window.

In some embodiments, if it is determined that the motion detectionwindow is followed by the autofocus window within the threshold verticaldistance, the CPU 208 performs autofocusing 1110 by adjusting at leastone property of a different autofocus window using a motion vectorcorresponding to the different autofocus window. For example, in theembodiment shown in FIG. 9, the CPU 208 may perform AF statistics basedon un-shifted autofocus windows 0, 1, or 2, and based on shiftedautofocus window 3. The at least one property may include any of theexample properties described above.

In other embodiments, if it is determined that the motion detectionwindow is followed by the autofocus window within the threshold verticaldistance, the CPU 208 generates a signal indicating that the currentmotion vector is not to be used for performing autofocusing on theautofocus window, e.g., to avoid back pressure on the VCA circuit 408 orfor read/write operations via DMA. The signal may be an interrupt, whichoccurs after processing of a given autofocus window, rather than at theend processing of an image frame. The CPU 208 may generate an interruptor signal for each active autofocus window of the image.

While particular embodiments and applications have been illustrated anddescribed, it is to be understood that the invention is not limited tothe precise construction and components disclosed herein and thatvarious modifications, changes and variations which will be apparent tothose skilled in the art may be made in the arrangement, operation anddetails of the method and apparatus disclosed herein without departingfrom the spirit and scope of the present disclosure.

What is claimed is:
 1. An image signal processor comprising: astatistics circuit configured to: determine row sums of pixel values ofeach block of pixels in a current image, and determine column sums ofthe pixel values of each block of pixels in the current image; and avector correlation analysis (VCA) circuit coupled to the statisticscircuit, the VCA circuit configured to: determine firstcross-correlation scores between the row sums of the pixel values ofeach block of pixels in the current image with row sums of pixel valuesof a corresponding block of pixels in a prior image preceding thecurrent image, determine second cross-correlation scores between thecolumn sums of the pixel values of each block of pixels in the currentimage with column sums of the pixel values of a corresponding block ofpixels in the prior image, and generate a motion vector for each blockof pixels in the current image by identifying a vertical shiftcorresponding to a greatest one of the first cross-correlation scoresand a horizontal shift corresponding to a greatest one of the secondcross-correlation scores.
 2. The image signal processor of claim 1,wherein the statistics circuit comprises: a first summation circuitconfigured to determine the row sums by adding the pixel values in eachrow of each block; and a second summation circuit configured todetermine the column sums by adding the pixel values in each column ofeach block.
 3. The image signal processor of claim 2, wherein thestatistics circuit further comprises: a mixer coupled to the firstsummation circuit and the second summation circuit, the mixer configuredto aggregate row sums and aggregate column sums of pixel values of aplurality of color components.
 4. The image signal processor of claim 3,wherein the plurality of color components include components for a red,red subtype of green, blue, and blue subtype of green.
 5. The imagesignal processor of claim 3, wherein the statistics circuit furthercomprises: a first multiplexer having (i) a first input coupled tooutput of the first summation circuit and (ii) a second input coupled tooutput of the second summation circuit, to selectively forward the rowsums and the column sums to the mixer; and a second multiplexer coupledto the first multiplexer and the mixer, the second multiplexerconfigured to select between outputs of the first multiplexer and themixer for storage using direct memory access.
 6. The image signalprocessor of claim 1, wherein a horizontal element of the motion vectoris an amount of the horizontal shift and a vertical element of themotion vector is an amount of the vertical shift.
 7. The image signalprocessor of claim 1, wherein the VCA circuit is further configured todetermine cross-correlation scores by: determining an amount ofhorizontal shift for each of the blocks of pixels in the current image;and determining an amount of vertical shift for each of the blocks ofpixels in the current image.
 8. The image signal processor of claim 1,wherein the VCA circuit is further configured to determinecross-correlation scores by: aggregating row sums of a first pluralityof the blocks of pixels in the current image in a horizontal directionto obtain an aggregate row sum; aggregating column sums of a secondplurality of the blocks of pixels in the current image in a verticaldirection to obtain an aggregate column sum; determining an amount ofvertical shift for the first plurality of the blocks of pixels using theaggregate row sum; and determining an amount of horizontal shift for thesecond plurality of the blocks of pixels using the aggregate column sum.9. The image signal processor of claim 1, wherein: the row sums of thepixel values of each block of pixels in the current image are determinedby adding a first number of rows of pixel values greater than a secondnumber of rows of pixel values added for the row sums of pixel values ofthe corresponding block of pixels in the prior image, and the columnsums of the pixel values of each block of pixels in the current imageare determined by adding a third number of columns of pixel valuesgreater than a fourth number of columns of pixel values added for thecolumn sums of pixel values of the corresponding block of pixels in theprior image.
 10. The image signal processor of claim 1, wherein the VCAcircuit is further configured to process one or more of the row sums ofpixel values or one or more of the column sums of pixel values using oneor more of: cropping, spatial binning, normalization, or transformationusing a lookup table.
 11. A method comprising: determining row sums ofpixel values of each block of pixels in a current image, and determiningcolumn sums of the pixel values of each block of pixels in the currentimage; determining first cross-correlation scores between the row sumsof the pixel values of each block of pixels in the current image withrow sums of pixel values of a corresponding block of pixels in a priorimage preceding the current image; determining second cross-correlationscores between the column sums of the pixel values of each block ofpixels in the current image with column sums of the pixel values of acorresponding block of pixels in the prior image; and generating amotion vector for each block of pixels in the current image byidentifying a vertical shift corresponding to a greatest one of thefirst cross-correlation scores and a horizontal shift corresponding to agreatest one of the second cross-correlation scores.
 12. The method ofclaim 11, further comprising: aggregating row sums and aggregate columnsums of pixel values of a plurality of color components.
 13. The methodof claim 11, wherein determining the first and second cross-correlationscores comprises: determining an amount of vertical shift for each ofthe blocks of pixels in the current image; and determining an amount ofhorizontal shift for each of the blocks of pixels in the current image.14. The method of claim 11, wherein determining the first and secondcross-correlation scores comprises: aggregating row sums of a firstplurality of the blocks of pixels in the current image in a horizontaldirection to obtain an aggregate row sum; aggregating column sums of asecond plurality of the blocks of pixels in the current image in avertical direction to obtain an aggregate column sum; determining anamount of vertical shift for the first plurality of the blocks of pixelsusing the aggregate row sum; and determining an amount of horizontalshift for the second plurality of the blocks of pixels using the columnrow sum.
 15. An electronic device comprising: an image sensor configuredto capture a current image; and an image signal processor coupled to theimage sensor, the image signal processor comprising: a statisticscircuit configured to: determine row sums of pixel values of each blockof pixels in the current image determine column sums of the pixel valuesof each block of pixels in the current image; and a vector correlationanalysis (VCA) circuit coupled to the statistics circuit, the VCAcircuit configured to: determine first cross-correlation scores betweenthe row sums of the pixel values of each block of pixels in the currentimage with row sums of pixel values of a corresponding block of pixelsin a prior image preceding the current image, determine secondcross-correlation scores between the column sums of the pixel values ofeach block of pixels in the current image with column sums of the pixelvalues of a corresponding block of pixels in the prior image, andgenerate a motion vector for each block of pixels in the current imageby identifying a vertical shift corresponding to a greatest one of thefirst cross-correlation scores and a horizontal shift corresponding to agreatest one of the second cross-correlation scores.
 16. The electronicdevice of claim 15, wherein the statistics circuit comprises: a firstsummation circuit configured to determine the row sums by adding thepixel values in each row of each block; a second summation circuitconfigured to determine the column sums by adding the pixel values ineach column of each block; and a mixer coupled to the first summationcircuit and the second summation circuit, the mixer configured toaggregate the row sums and aggregate the column sums of pixel values ofa plurality of color components.
 17. The electronic device of claim 16,wherein the plurality of color components include components for a red,red subtype of green, blue, and blue subtype of green.
 18. Theelectronic device of claim 15, wherein a horizontal element of themotion vector is an amount of the horizontal shift and a verticalelement of the motion vector is an amount of the vertical shift.
 19. Theelectronic device of claim 15, wherein the VCA circuit is furtherconfigured to determine cross-correlation scores by: determining anamount of horizontal shift for each of the blocks of pixels in thecurrent image; and determining an amount of vertical shift for each ofthe blocks of pixels in the current image.
 20. The electronic device ofclaim 15, wherein the VCA circuit is further configured to determinecross-correlation scores by: aggregating row sums of a first pluralityof the blocks of pixels in the current image in a horizontal directionto obtain an aggregate row sum; aggregating column sums of a secondplurality of the blocks of pixels in the current image in a verticaldirection to obtain an aggregate column sum; determining an amount ofvertical shift for the first plurality of the blocks of pixels using theaggregate row sum; and determining an amount of horizontal shift for thesecond plurality of the blocks of pixels using the column row sum.